<link rel="stylesheet" type="text/css" href="../addons/jy_inclock/resource/task.css"/>
<title>任务中心</title>
	<div class="fui-page">
		<div class="fui-header">
            <div class="fui-header-left" ng-click="goback()">
                <a class="back"></a>
            </div>
            <div class="title">任务详情</div>
            <div class="fui-header-right">

            </div>
       </div>
		<div class="fui-content">
			<div class="taskdetail-list">
				<div class="taskdetail-list-media">
					<img src="{{tomedia(pagedata.detail.image)}}"/>
				</div>
				<div class="taskdetail-list-inner">
					<div class="title">{{pagedata.detail.tasktitle}}{{pagedata.detail.title}}</div>
					<span class="text-danger">{{pagedata.desc}}</span>
					<div class="time">
						<!--已接任务-->
						<p ng-if="pagedata.record.task_demand">领取时间：{{pagedata.record.picktime}}</p>
						<p ng-if="pagedata.record.task_demand">截至时间：{{ifelse(pagedata.record.stoptime=='0000-00-00 00:00:00','无限制',pagedata.record.stoptime)}}</p>
						<!--未接任务-->
						<p ng-if="!pagedata.record.task_demand">开放时间：{{pagedata.detail.starttime}}</p>
						<p ng-if="pagedata.record.task_demand">结束时间：{{pagedata.detail.endtime}}</p>
                        <p ng-if="!pagedata.record.task_demand && pagedata.stop_limit>0" class="text-danger">限时：限时{{pagedata.detail.stop_limit/3600}}小时</p>
					</div> 
					<div class="task-icon-group">
                        <i class="icon icon-jifen red"><span class="subtitle">{{pagedata.detail.rewarddesc}}</span></i>
                    </div>
					<!--已接任务-->
					<div ng-if="pagedata.record.task_demand" class="taskdetail-progress">
						<div class="progress">
							<div class="progress-inner" style="width: {{pagedata.record.task_progress/pagedata.record.task_demand*100}}%"></div>
						</div>
						<span class="times">{{pagedata.record.task_progress}}/{{pagedata.record.task_demand}}</span>
						<div ng-if="pagedata.record.ispass!=1" class="btn btn-sm btn-danger-o r-f" style="margin-left:0.5rem;border-radius:1rem" href="javascript:;" ng-click="access_json('/add_log//id='+pagedata.record.id)">前往打卡</div>
						<div class="btn btn-sm btn-danger-o r-f" style="margin-left:0.5rem;border-radius:1rem" href="javascript:;" ng-click="access_json('/log//id='+pagedata.record.id)">打卡记录</div>
						<div ng-if="pagedata.record.ispass==1 && pagedata.record.isreward!=1" class="btn btn-sm btn-danger-o r-f" style="margin-left:0.5rem;border-radius:1rem" href="javascript:;" ng-click="post({},'/mine/checkfinish/id='+pagedata.record.id)">领取奖励</div>
					</div>
					<div ng-if="!pagedata.record.task_demand" class="taskdetail-progress">
						<div class="btn btn-sm btn-danger-o r-f" style="margin-left:0.5rem;border-radius:1rem" href="javascript:;" ng-click="access_json('/pickTask//taskid='+pagedata.detail.id)">做任务</div>
					</div>
				</div>
			</div>
			<div class="content-block content-images" style="padding:0.5rem;background:#fff" ng-bind-html="trust(pagedata.detail.content)"></div>

		</div>
	</div>
<div ng-include="sys_html('_footer')"></div>	
<script>
scope.pagedata.send=function(img){
	var params={
		data:{'img':img},
		op:'send',
		callback:function(res){
			if(res.ok==1)
			scope.message('发送成功，请在微信公众号中查看');
			else{
				scope.message('发送失败');
			}
		}
	};
	scope.post_json(params);
}
scope.pagedata.getReward=function(detail_id){
	var params={
		data:{'detail_id':detail_id},
		op:'getReward',
		callback:function(res){
			if(res.ok==1)
			scope.message('奖品已发放');
			else{
				scope.message('奖品发送失败');
			}
		}
	};
	scope.post_json(params);
}
var token = window.scope.pagedata.token;
function sendToWechat(img) {//发送到微信
	scope.post_json('jy_inclock/detail/send1/',{'img':img},function(res){
		if (res.ok == 1){
			scope.message('推送成功,请在微信公众号中查看')
		}else{
			scope.message('推送失败,可能长时间未与公众号互动')
		}
    });
}
$('.pickit').click(function () {
	 var id = $(this).data('id');
        if (id != undefined){
			scope.post_json('jy_inclock/pickTask//taskid='+id,{},function(res){
				if (res.ok == 1){
					scope.message('接取成功')
				}else{
					scope.message('接取失败,'+res.message)
				}
			});
		}
})
</script>
